package ru.linnenson.darshana.infrastructure.rest;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import ru.linnenson.darshana.application.domain.SubjectEnum;
import ru.linnenson.darshana.application.services.DictionaryService;
import ru.linnenson.darshana.infrastructure.rest.dto.DictionaryDto;
import ru.linnenson.darshana.infrastructure.rest.dto.TagDto;
import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/dictionaries")
@RequiredArgsConstructor
public class DictionaryResource {

  private final DictionaryService dictionaryService;

  @GetMapping("/sources")
  public ResponseEntity<List<DictionaryDto>> getSources(@RequestParam SubjectEnum subject) {
    return ResponseEntity.ok(dictionaryService.getSources(subject));
  }

  @GetMapping("/levels")
  public ResponseEntity<List<DictionaryDto>> getLevels(@RequestParam SubjectEnum subject) {
    return ResponseEntity.ok(dictionaryService.getLevels(subject));
  }

  @GetMapping("/numbers-in-kim")
  public ResponseEntity<List<DictionaryDto>> getNumbersInKim(@RequestParam SubjectEnum subject) {
    return ResponseEntity.ok(dictionaryService.getNumbersInKim(subject));
  }

  @GetMapping("/themes")
  public ResponseEntity<List<DictionaryDto>> getThemes(@RequestParam SubjectEnum subject) {
    return ResponseEntity.ok(dictionaryService.getThemes(subject));
  }

  @GetMapping("/tags")
  public ResponseEntity<List<TagDto>> getTags(@RequestParam SubjectEnum subject) {
    return ResponseEntity.ok(dictionaryService.getTags(subject));
  }
}
